import java.util.Scanner;

public class c7 {
    //用户输入整数n，计算1!+(1!+2!)+(1!+2!+3!)+…..+(1!+2!+…n!)
    //用方法实现,有参数有返回值
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("用户输入整数:");
        int  n=scanner.nextInt();
        System.out.println(jisuan(n));
    }
    public static double  jisuan(int n ) {

        double sum = 0;
        for (int i = 1; i <= n; i++) {
            int p = 1;
            for (int j = 1; j <= i; j++) {
                p *= j;
            }
            sum +=  p;
        }

        return sum;
    }}
